<?php
    /**
     * Created by PhpStorm.
     * User: zgh
     * Date: 2021-07-29
     * Time: 15:02
     */

    namespace app\common\service;


    use think\facade\Env;

    class SystemService
    {


        public static function clearCache()
        {
            SysConfigService::clearCache();
            self::clearRuntime();
            self::clearUploadRuntime();
        }

        /**
         * @param string $dir
         * @return bool
         */
        public static function clearRuntime($dir = "")
        {
            if (empty($dir)) {
                $dir = realpath(Env::get("app_path") . "/../runtime");
            }
            delete_dir_file($dir);
            return true;
        }

        public static function clearUploadRuntime($dir="")
        {
            if (empty($dir)) {
                $dir = realpath(Env::get("app_path") . "/../public/tmp");
            }
            delete_dir_file($dir);
            return true;
        }


    }